package com.xiaojianone.controller;

import com.xiaojianone.pojo.vo.PortalVo;
import com.xiaojianone.service.HeadlineService;
import com.xiaojianone.service.TypeService;
import com.xiaojianone.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName  PortalController
 * Author  XiaojianOne
 * Date  2025/2/18 18:05
 * Version  8.0
 */

@RestController
@RequestMapping("portal")
@CrossOrigin
public class PortalController {

    @Autowired
    private TypeService typeService;

    @Autowired
    private HeadlineService headlineService;


    @GetMapping("findAllTypes")
    public Result findAllTypes(){

        Result result =typeService.findAllTypes();

        return result;
    }


    @PostMapping("findNewsPage")
    public Result findNewsPage(@RequestBody PortalVo portalVo){

        Result result =headlineService.findNewsPage(portalVo);
        return result;
    }


    @PostMapping("showHeadlineDetail")
    public Result showHeadlineDetail(@RequestParam("hid") Integer hid){

        Result result = headlineService.showHeadlineDetail(hid);

        return result;
    }

}
